$( init1 );

// Initialize the form

function init1() {

		// this one requires the value to be the same as the first parameter
		$.validator.methods.equal = function(value, element, param) {
			return value == param;
		};
		$.validator.addMethod("alphanumeric", function(value) {
			return value.match( "^\\w+$");
		});
		// this one requires the value to be the same as the first parameter
		$.validator.methods.equal = function(value, element, param) {
			return value == param;
		};
		$.validator.addMethod("date", function(value) {
			return value.match( "^((((19|20)(([02468][048])|([13579][26]))-02-29))|((20[0-9][0-9])|(19[0-9][0-9]))-((((0[1-9])|(1[0-2]))-((0[1-9])|(1\\d)|(2[0-8])))|((((0[13578])|(1[02]))-31)|(((0[1,3-9])|(1[0-2]))-(29|30)))))$");
		}, 'Please enter valid date!');
		$("#addItemForm").validate({
			rules: {
				itemDescription: {
					required: true,
					minlength: 10
				},
				stDate: "date",
				endDate: "date"
			},
			messages: {itemDescription: { 
				required:"Plesae enter The description",
				minlength:"the description can not be less than 10 letters"
				}
			}
		});
		$("#editPlanForm").validate({
			rules: {
				title: {
					required: true,
					minlength: 3,
					alphanumeric:true
				},
				newDescription:{
					required: true,
					minlength: 10,
				},
				newStartDate:{
					required: true,
					date: true
				} ,
				newEndDate: {
					required: true,
					date: true
				}
			},
			messages: {
				title: {
				minlength: "title can not be less than 3 letters!!",
				alphanumeric: "Only alpha-numeric text is allowed for the title",
				required:"Please enter a title for the plan"
				},
				description:{
					required: "Please enter a description for the plan",
					minlength: "The plan description can not be less than 10 characters"
				},
				stDate:{
					required: "Please enter the start date",
					date: "please enter a valid date like that YYYY-MM-DD"
				} ,
				endDate: {
					required: "please enter the end date",
					date: "please enter a valid date like that YYYY-MM-DD"
				}
			}
		});
		
		$("#createPlanForm").validate({
			rules: {
				title: {
					required: true,
					alphanumeric:true
				},
				description:{
					required: true,
					minlength: 10,
				},
				stDate:{
					required: true,
					date: true
				} ,
				endDate: {
					required: true,
					date: true
				}
			},
			messages: {
				title: {
				alphanumeric: "Only alpha-numeric text is allowed for the title",
				required:"Please enter a title for the plan",
				},
				description:{
					required: "Please enter a description for the plan",
					minlength: "The plan description can not be less than 10 characters",
				},
				stDate:{
					required: "Please enter the start date",
					date: "please enter a valid date like that YYYY-MM-DD"
				} ,
				endDate: {
					required: "please enter the end date",
					date: "please enter a valid date like that YYYY-MM-DD"
				}
			}
		});
		
		$("#viewDraftForm").validate({
			rules: {
				title: {
					required: true,
				},
		content: {
			required: true,
		}
			},
			messages: {
				title: {
				required:"Idea Title is required !"
				},
				content: {
					required:"Idea Content is required !"
					}
			}
		});
		
		$("#viewDraftRequest").validate({
			rules: {
				name: {
					required: true,
				},
				description: {
					required: true
				}
			},
			messages: {
				name: {
				required:"Topic Name is required !"
				},name: {
				required:"Topic Description is required !"
				}
			}
		});
		

		$("#mergeIdeas").validate({
			rules: {
				title: {
					required: true,
				},
				content: {
					required: true,
				}
				
			},
			messages: {
				title: {
				required:"Topic Name is required !"
				},
				content: {
					required:"Content is required !"
					}
				
			}
		});
		
		$("#addV").validate({
			rules: {
				video: {
					required: true
				}
			},
			messages: {
				video: {
				required:"Video Link is required !",
				}	
			}
		});
		$("#viewMergeRequest").validate({
			rules: {
				report: {
					required: true,
					minlength:10
				}
			},
			messages: {
				report: {
				required:"Merge Report is required !",
				minlength:"The minimum length required is 10 characters."
				}	
			}
		});
		
		$("#viewCreateRequest").validate({
			rules: {
				name: {
					required: true
				},
				description:{
					required: true
				}
			},
			messages: {
				name: {
				required:"Name is required!"
				},
				description: {
					required:"Content is required!"
					}
			}
		});

		
		$("#editEntityForm").validate({
		rules:{
			entName:{
				required:true
				},
			lock:{
				required:true
				},				
			entDescription:{
				required:true
				}
			},
			messages:{
				entName:{required:"Name is required!"},
				lock:{required:"A lock status is required!"},
				entDescription:{required:"Description is required!"}
				}
			});
			
		$("#addEntityForm").validate({
		rules:{
			entName:{
				required:true
				},
			lock:{
				required:true
				},				
			entDescrip:{
				required:true
				}
			},
			messages:{
				entName:{required:"Name is required!"},
				lock:{required:"A lock status is required!"},
				entDescrip:{required:"Description is required!"}
				}
			});

		
		$("#userMail").validate({
			rules: {
				mail: {
					required: true,
					email: true
				}
			},
			messages: {
				mail: {
				email: "Enter a correct E-mail form",
				required:"Please enter your e-mail",
				}
			}
		});
		
		  $("#giveLeadFrom").validate({
              rules: {                                              
            	  organizerID: {       
                              required: true
                      }
              },
              messages: {organizerID: {
                      required:"Please choose at least one organizer"
                      }
              }
      });
		  
		  $("#RemoveLeadForm").validate({
              rules: {                                              
            	  organizerID: {       
                              required: true
                      }
              },
              messages: {organizerID: {
                      required:"Please choose at least one organizer"
                      }
              }
      });
		  
		  $("#adminDoneEdit").validate({
              rules: {                                              
            	      newGender: {       
                              required: true
                      }
              },
              messages: {newGender: {
                      required:"Please choose the gender"
                      }
              }
      });

		
		$("#statusAI").validate({
			rules: {
				progress: {
					required: true,
					number: true
				}
			},
			messages: {
				progress: {
				number: "Enter a correct number",
				required:"Please enter the new progress",
				}
			}
		});
		
		
		$("#postIdeaForm").validate({
			rules: {
				title: {
					required: true,
			},
			content: {
				required: true,
				}
			},
			messages: {
			title: {
			required:"Idea Title is required !"
			},
			content: {
				required:"Idea Content is required !"
				}
			}
		});
		
		$("#postTopicForm").validate({
			rules: {
				name: {
					required: true,
			},
			description: {
				required: true,
				}
			},
			messages: {
			title: {
			required:"Topic name is required !"
			},
			description: {
				required:"Topic description is required !"
				}
			}
		});
		
		$("#editActionItemForm").validate({
			rules: {
				newDescription:{
					required: true,
					minlength: 10,
				},
				newStartDate:{
					required: true,
					date: true
				} ,
				newEndDate: {
					required: true,
					date: true
				}
			},
			messages: {
				description:{
					required: "Please enter a description for the action item",
					minlength: "The item description can not be less than 10 characters",
				},
				stDate:{
					required: "Please enter the start date",
					date: "please enter a valid date like that YYYY-MM-DD"
				} ,
				endDate: {
					required: "please enter the end date",
					date: "please enter a valid date like that YYYY-MM-DD"
				}
			}
			});
			
			$("#tagTopicForm").validate({
			rules: {
				name: {
					required: true,
					}
			},
			messages: {
			name: {
			required:"Tag name is required !"
			}
			}
		});

		
}